Added support for SET TERMINATOR instruction#51
Open
Cybso wants to merge 3 commits intosquirrel-sql-client:masterfrom
Open
Added support for SET TERMINATOR instruction#51Cybso wants to merge 3 commits intosquirrel-sql-client:masterfrom
Cybso wants to merge 3 commits intosquirrel-sql-client:masterfrom
Conversation
This allows to temporarily change the statement separator with an inline comment and thus supports to execute statements that uses the semicolon within their expression, for example triggers or procedures with `BEGIN..END` blocks.
Example:
```sql
DROP PROCEDURE foobar;
--#SET TERMINATOR !
CREATE PROCEDURE foobar
BEGIN
declare v char(10);
select value into v from sometable;
if v = 'test' then
update sometable set value = '';
end if;
END!
--#SET TERMINATOR ;
LABEL ON PROCEDURE foobar IS 'Example';
```
This commit fixes feature request 433 on sourceforge (https://sourceforge.net/p/squirrel-sql/feature-requests/433/).
It currently only supports the default QueryTokenizer. The statement separator is only changed for the current execution.
…with other length than 2
514893b to
0894f47
Compare
This makes this feature compatible to IBM CLP and Data Architect. The documentation states: > The statement must be uppercase and in a comment. There can be leading spaces before the --, but there cannot be spaces between -- and #SET TERMINATOR x https://www.ibm.com/docs/en/ida/9.1.2?topic=terminators-changing-sql-statement-terminator
gerdwagner
pushed a commit
that referenced
this pull request
Nov 30, 2024
To change the statement separator during SQL execution, use the following command on a separate line: --#SET TERMINATOR <separator> This command does not change the separator permanently but for a single SQL execution only. See also menu File --> New Session Properties --> tab SQL --> section "Statement separator" Thanks to Roland Tapken for the pull request
Member
|
Was merged with several adjustments. Please take a look if it still works for you. Most of your code is now in the new ChangeStatementSeparatorSupport class. Thanks for your pull request. |
Contributor
Author
I haven't completely figured out the integration, but it looks pretty good at first glance. I have added three small notes to the commit. In particular, the method isCommandPrecededBySpacesOrTabsOnly is named incorrectly or the return value is the wrong way around. However, since the call also takes this into account, it still works at the moment, it's just not intuitive: if(isCommandPrecededBySpacesOrTabsOnly(_script, searchStartPos))
{
return null;
} |
gerdwagner
added a commit
that referenced
this pull request
Dec 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows to temporarily change the statement separator with an inline comment and thus supports to execute statements that uses the semicolon within their expression, for example triggers or procedures with
BEGIN..ENDblocks.Example:
This commit fixes feature request 433 on sourceforge (https://sourceforge.net/p/squirrel-sql/feature-requests/433/).
It currently only supports the default QueryTokenizer. The statement separator is only changed for the current execution.